<div class="col-md-9 customer-list" style="display:none">
	<div style="width:100%;height:90px;"></div>
	<div class="panel panel-default" style="margin-top:10px;">
		<div class="panel-heading">
		  <h4 class="panel-title">
			<a class="accordion-toggle data-parent="#accordion">客户跟踪笔记</a>
			<i class="glyphicon glyphicon-plus pull-right add-customer tooltips" data-placement="left" data-toggle="tooltip" data-original-title="添加客户" style="font-size: 25px;margin-top:-5px"></i>
		  </h4>
		</div>
		<div id="collapseOne" class="panel-collapse collapse in">
		  <div class="panel-body customer-lists">
			
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="myTab">
	<li class="active"><a href="#recent" data-toggle="tab" target="recent">最近更新</a></li>
	<volist name="group" id="vo">
	<li><a href="#{$vo.target}" target="{$vo.target}" data-toggle="tab">{$vo.group_name}</a></li>
	</volist>
</ul>

<!-- Tab panes -->
<div class="tab-content" style="padding-top:20px;">
	<div class="tab-pane fade in active" id="recent">
	<if condition="$customerlist eq NULL">
		<h4 style="text-align:center"><span class="label label-primary">昨日没有更新记录</span></h4>
		<else />
		<ul class="list-group">
			<volist name="customerlist" id="vo">
			<li class="list-group-item">
				<i class="customer-avatar pull-left"></i>【{$vo.group_name}】
				<a id="{$vo.customer_id}" class="customer-name">{$vo.customer_name}</a>
				<span class="pull-right">最后更新:<i>{$vo.update_time}</i></span>
				<span class="pull-right" style="margin-right:15px;">记录:<i>{$vo.track_num}</i>条</span>
			</li>
			</volist>
		</ul>
	</if>
	</div>
	<volist name="group" id="vo">
	<div class="tab-pane fade" id="{$vo.target}"></div>
	</volist>
</div>
		  </div>
		</div>
	</div>
	



</div>
<script>
	$(".tooltips").tooltip();
	$(function(){
		$(".customer-name").die().live('click',function(){
			var title = $(this).html();
			var customer_id = $(this).attr("id");
			$(".customer-track-title").html("客户:"+title);
			$(".track-lists").load('__APP__/Customer/customerInfo',{type:'tracklist',customer_id:customer_id});
			$(".customer-track-remark .panel-body").load('__APP__/Customer/customerInfo',{customer_id:customer_id},function(){
				$(".leavetrack").attr("id",customer_id);
				$(".leavetrack").unbind('click').click(function(){	
					html = editor3.html();
					var customer_id = $(this).attr("id");
					var content = html;
					if(content == ""){
						$.globalMessenger().post("跟踪记录不能为空");
						return;
					}
					$.post('__APP__/Customer/addTrack',{customer_id:customer_id,content:content},function(json){
						$.globalMessenger().post(json.info);
						if(json.status == 1){
							//var insertTrack = "<div class='panel panel-default comment-list' style='display:none'><div class='panel-heading'><h4 class='panel-title'><a class='accordion-toggle' data-parent='#accordion'>"+json.data.replier+"&nbsp;&nbsp;&nbsp;"+json.data.create_time+"</a></h4></div><div id='collapseOne' class='panel-collapse collapse in'><div class='panel-body' style='word-break: break-all;'>"+json.data.comment+"</div></div></div>";
							if($(".track-lists h4").length == 1){
								$(".track-lists h4").remove();
							}
							editor3.html("");
						}
					})
				});
				$("#customer-track").modal('show');
			});
		});
		$('#myTab a').click(function(e){
			e.preventDefault();
			var target = $(this).attr("target");
			if($("#"+target+" .list-group").length != 0 || target == "recent") return;
			$("#"+target).load('__APP__/Customer/customerList',{target:target},function(){
				$(this).tab('show');
			});
		});
	});
</script>